package org.vt.scheduleapp;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;


import android.content.Context;

public class EventWriter {
	
	private final String FILENAME = "event_file.txt";
	private FileOutputStream fos;
	private Context mCtx;
	
	public EventWriter(Context context)
	{
		mCtx = context;
	}
	
	public void writeEvent(List<CalendarEvent> events) throws IOException, FileNotFoundException
	{
		fos = mCtx.openFileOutput(FILENAME, Context.MODE_PRIVATE);
		for(CalendarEvent event:events)
		{
			String locString = "\n"+event.toString();
			fos.write(locString.getBytes());
		}
		fos.close();
	}

}
